import request from "../utils/request";


export const findByIdService = (id) => {
    const params={'id':id}
    return request.get("/notice/findById",{params:params})
}

export const getListService = (pageNum,pageSize) => {
    const params={'pageNum':pageNum,'pageSize':pageSize}
    return request.get("/notice/getList", {params:params})
}

export const addNoticeService = (form) => {
    const params = new URLSearchParams()
    for (let key in form) {
        params.append(key, form[key])
    }
    return request.post("/notice/addNotice",params)
}

export const publishService = (id) => {
    const params = new URLSearchParams()
    params.append('id', id)
    return request.put("/notice/publish",params)
}

export const deleteNoticeService = (id) => {
    const params = new URLSearchParams()
    params.append('id', id)
    return request.put("/notice/deleteNotice",params)
}

export const updateNoticeService = (form) => {
    const params = new URLSearchParams()
    for (let key in form) {
        params.append(key, form[key])
    }
    return request.post("/notice/updateNotice",params)
}

export const getByTypeService = (type,pageNum,pageSize) => {
    const params={'type':type,'pageNum':pageNum,'pageSize':pageSize}
    return request.get("/notice/getByType",{params:params})
}